package com.sthz.facepay.mapper;

import static org.apache.ibatis.jdbc.SqlBuilder.BEGIN;
import static org.apache.ibatis.jdbc.SqlBuilder.INSERT_INTO;
import static org.apache.ibatis.jdbc.SqlBuilder.SET;
import static org.apache.ibatis.jdbc.SqlBuilder.SQL;
import static org.apache.ibatis.jdbc.SqlBuilder.UPDATE;
import static org.apache.ibatis.jdbc.SqlBuilder.VALUES;
import static org.apache.ibatis.jdbc.SqlBuilder.WHERE;

import com.sthz.facepay.model.Shareprofi;

public class ShareprofiSqlProvider {

    public String insertSelective(Shareprofi record) {
        BEGIN();
        INSERT_INTO("st_shareprofit");
        
        if (record.getId() != null) {
            VALUES("id", "#{id,jdbcType=INTEGER}");
        }

        
        if (record.getPay_method() != null) {
            VALUES("pay_method", "#{pay_method,jdbcType=VARCHAR}");
        }
        
        if (record.getExternal_serial_numbe() != null) {
            VALUES("external_serial_numbe", "#{external_serial_numbe,jdbcType=VARCHAR}");
        }
        
        if (record.getInside_serial_numbe() != null) {
            VALUES("inside_serial_numbe", "#{inside_serial_numbe,jdbcType=VARCHAR}");
        }
        
        if (record.getOrder_money() != null) {
            VALUES("order_money", "#{order_money,jdbcType=DOUBLE}");
        }
        
        if (record.getRate() != null) {
            VALUES("rate", "#{rate,jdbcType=INTEGER}");
        }
        
        if (record.getAgent_profit() != null) {
            VALUES("agent_profit", "#{agent_profit,jdbcType=VARCHAR}");
        }
        
        if (record.getPay_time() != null) {
            VALUES("pay_time", "#{pay_time,jdbcType=TIMESTAMP}");
        }
        
        if (record.getState() != null) {
            VALUES("state", "#{state,jdbcType=TINYINT}");
        }
        
        if (record.getAgent_income() != null) {
            VALUES("agent_income", "#{agent_income,jdbcType=DOUBLE}");
        }
        
        if (record.getOrder_numebr() != null) {
            VALUES("order_numebr", "#{order_numebr,jdbcType=VARCHAR}");
        }
        
        if (record.getPlatform_numebr() != null) {
            VALUES("platform_numebr", "#{platform_numebr,jdbcType=VARCHAR}");
        }
        
        return SQL();
    }

    public String updateByPrimaryKeySelective(Shareprofi record) {
        BEGIN();
        UPDATE("st_shareprofit");

        
        if (record.getPay_method() != null) {
            SET("pay_method = #{pay_method,jdbcType=VARCHAR}");
        }
        
        if (record.getExternal_serial_numbe() != null) {
            SET("external_serial_numbe = #{external_serial_numbe,jdbcType=VARCHAR}");
        }
        
        if (record.getInside_serial_numbe() != null) {
            SET("inside_serial_numbe = #{inside_serial_numbe,jdbcType=VARCHAR}");
        }
        
        if (record.getOrder_money() != null) {
            SET("order_money = #{order_money,jdbcType=DOUBLE}");
        }
        
        if (record.getRate() != null) {
            SET("rate = #{rate,jdbcType=INTEGER}");
        }
        
        if (record.getAgent_profit() != null) {
            SET("agent_profit = #{agent_profit,jdbcType=VARCHAR}");
        }
        
        if (record.getPay_time() != null) {
            SET("pay_time = #{pay_time,jdbcType=TIMESTAMP}");
        }
        
        if (record.getState() != null) {
            SET("state = #{state,jdbcType=TINYINT}");
        }
        
        if (record.getAgent_income() != null) {
            SET("agent_income = #{agent_income,jdbcType=DOUBLE}");
        }
        
        if (record.getOrder_numebr() != null) {
            SET("order_numebr = #{order_numebr,jdbcType=VARCHAR}");
        }
        
        if (record.getPlatform_numebr() != null) {
            SET("platform_numebr = #{platform_numebr,jdbcType=VARCHAR}");
        }
        
        WHERE("id = #{id,jdbcType=INTEGER}");
        
        return SQL();
    }
}